﻿using demo1.Entity;
using demo1.Interface;
using demo1.Service;
using Microsoft.AspNetCore.Mvc;

namespace demo1.Controllers
{
    [ApiController]
    [Route("controller/[Action]")]
    public class PeopleControll
    {
        Ipeople _p;
        public PeopleControll(Ipeople p)
        {
            _p = p;
        }
        [HttpGet]
        public List<PeopleEntity> Get([FromQuery] string? id)
        {
            return _p.Get(id);
        }
        [HttpPost]
        public string Add(PeopleEntity entity) { 
          var res=_p.Add(entity);
            if (res > 0)
            {
                return "添加成功";
            }
            else
            {
                return "添加失败";
            }
        }
    }
}
